/*
 * FileName: bee.js
 * CreateAt: 2017.06.21
 * Version: 0.0.1
 * Author: awoo
 * E-mail: awoooo@me.com
 */

const color = require('./color')
const _ = require('./interal')

class Bee {
  constructor (obj) { this._ = obj }

  _getType (any) { return toString.call(any).slice(8, -1) }
  _checkType (type) { return _._checkType.call(this, type) }

  limit (min, max) {
    let num = this._checkType('Number')
    this._ = Math.min(max, Math.max(min, num))
    return this
  }

  get color () { return color.color.call(this) }
  toHex () { return color.toHex.call(this) }
  to3Hex () { return color.to3Hex.call(this) }
  toRgb () { return color.toRgb.call(this) }

  get val () { return this._ }
}

exports.$ = function (obj) { return new Bee(obj) }
